﻿using System;
using System.Data;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;
using AnyOffice.Model;

namespace AnyOffice.general.attend.manage
{
    public partial class evection_confirm : ModulePage
    {
   
 
        protected void Page_Load(object sender, EventArgs e)
        {
            int evectionId = (Request.QueryString["evection_id"] != null) ? int.Parse(Request.QueryString["evection_id"].ToString()) : 0;
            bool isMobile = (Request.QueryString["is_mobile"] != null) ? bool.Parse(Request.QueryString["is_mobile"].ToString()) : false;
            new AttendEvectionDao().Confim(base.Conn, evectionId);
            if (isMobile)
            {
                DataTable table = new AttendEvectionDao().SelectByEvectionId(base.Conn, evectionId);
                if (table.Rows.Count > 0)
                {
                    SmsData data = new SmsData();
                    SmsDao dao = new SmsDao();
                    data.Type = 6;
                    data.FromId = base.User.Identity.Name;
                    data.ToId = table.Rows[0]["UserId"].ToString();
                    data.Content = "您的出差申请已被批准！";
                    data.RemindFlag = true;
                    data.SendTime = DateTime.Now;
                    dao.BizSend(base.Conn, data, true, isMobile);
                }
            }
            base.CloseConn();
            Response.Redirect("confirm.aspx");
        }

    }
}
